<template>
  <div id="app">
    <Header></Header>
    <!-- <AuthenModal /> -->
    <router-view class="page-wrapper" />
    <!-- 部分路由不应该包含这个Footer -->
    <Footer v-if="excludeRoutes.indexOf($route.name) == -1"></Footer>
    <Im ref="im"></Im>
  </div>
</template>

<script>
import Header from "@/components/header/Header";
import Footer from "@/components/footer/Footer";
import AuthenModal from "@/components/authentication/AuthenModal"
import Im from '@/components/im/Im'
export default {
  name: "App",
    metaInfo:{
      title: '优趣联盟'
  },
  beforeRouteEnter(to, from, next) {
    window.scrollTo(0, 0);
    next();
  },
  data() {
    return {
      excludeRoutes: [
        "HomeIndex",
        "MyAddress",
        "AddAddress",
        "MyOrder",
        "MyShoppingCart",
      ],
    };
  },
  components: {
    Im,
    Header,
    Footer,
    AuthenModal
  },
  created(){
    this.pcWebConfig();

    if (this.$store.state.token) {
      this.$store.dispatch('getUserInfo')
    }
    // this.pcorh5()
    // window.addEventListener("resize",this.pcorh5)
  },
  methods:{
    pcorh5(){
      try {
        // 根据PC判断
        const isPc = window.innerWidth >= 750
        var host=window.location.hostname
        console.log(isPc,host)
        // let tabId = import.meta.env.WEB_ID
        if (!isPc)
          window.location.href="https://wap.zhifunews.com/#/";
        //   tabId = import.meta.env.PC_ID

      }
      catch (error) {
        console.error(error)
      }
    },
    //获取网站配置信息
    pcWebConfig(){
      this.$http.pcWebConfig().then(res=>{
        if(res.status == 200){
          document.title = res.data.webtitle
          localStorage.setItem("webConfig", JSON.stringify(res.data));
        }
      })
    },

    showIm (user) {
      this.$refs.im.show(user)
    }
  }
};
</script>

<style lang="scss">
@import "./common/style/reset.css";
@import "@icon-park/vue/styles/index.css";
@import "@/common/style/common.scss";

body {
  background-color: #f9f9f9!important;
}
#app {
  padding-top: 40px;
}

.w {
  width: 1190px;
  margin: 0 auto;
}
/deep/ .ivu-input:hover{
  border:none
}

.page-wrapper {
  min-height: calc(100vh - 260px);
}
.flex{
  @include flex()
}
.ivu-checkbox-inner{
  border-radius: 100px;
}
.ivu-checkbox-checked .ivu-checkbox-inner{
  border: 1px solid #e2231a;
  background-color: #e2231a;
}
.mt-20{
  margin-top: 20px;
}
.ivu-btn-error{
  background-color:#e2231a;
  height: 50px;
}
input:-internal-autofill-selected {
  background-color: transparent !important;;
}
input:-webkit-autofill {
  transition: background-color 2000s;
}
::v-deep .ivu-input:focus{
  border-color: transparent!important;
}
::v-deep .ivu-input:hover{
  border-color: transparent!important;
}
/deep/ .ivu-form-item-error .ivu-input:focus{
  border: none;
  box-shadow: none;
}
/deep/ .ivu-input:hover{
  border: none;
}
/deep/ .ivu-input-group-append{
  border: none;
}
/deep/ .ivu-btn:focus{
  box-shadow:none;
}
</style>
